# -*- coding:utf-8 -*-
# class ListNode:
#     def __init__(self, x):
#         self.val = x
#         self.next = None
class Solution:
    # 返回合并后列表
    def Merge(self, pHead1, pHead2):
        p1 = pHead1
        p2 = pHead2
        l = list()
        
        while (p1):
            l.append(p1.val)
            p1 = p1.next
        
        while (p2):
            l.append(p2.val)
            p2 = p2.next
        
        if l == []:
            return None
        
        l.sort()
        head = ListNode(l[0])
        p3 = head
        
        for i in l[1:]:
            node = ListNode(i)
            p3.next = node
            p3 = p3.next
            
        return head
        # write code here